<!--
* description: 整车销售---订单管理
* author:xlc
* createdDate: 2020-11-17
-->
<template>
  <div class="app-container app-container-table">
    <one-table-template
      ref="multipleTable"
      :dynamic-buttons="tableButtons"
      :dynamic-components="tableComponents"
      :dynamic-api-config="apiConfig"
      :dynamic-table-cols="tableCols"
      :dynamic-form-fields="formField"
      :dynamic-is-show-select="false"
      :callback-obj="callbackObj"
      :dynamic-toggle-param="true"
      :refresh-table-key="refreshTableKey"
    >
      <!-- 操作列 -->
      <template #controlBtn="scope">
        <section
          key="addPDI"
          class="linkButton"
        >
          <a
            v-show="PDishow(scope.row)"
            @click="addPDI(scope.row)"
          >新车PDI</a>
        </section>
        <section
          key="invoice"
          class="linkButton"
        >
          <a
            v-show="scope.row.orderStatus==='14'"
            @click="invoice(scope.row)"
          >开票申请</a>
        </section>
        <section
          key="details"
          class="linkButton"
        >
          <a
            @click="details(scope.row)"
          >详情</a>
        </section>
      </template>
      <template #remark="scope">
        <el-col
          id="remark"
          key="remark"
          :span="dateSpan"
        >
          <el-input
            v-model="scope.row.remark"
            placeholder="输入完回车保存"
            @keyup.enter.native="remarkSend(scope.row)"
          />
        </el-col>
      </template>
      <template #APPOINTMENTDATE="scope">
        <el-col
          id="datePicker"
          key="datePicker"
          :span="dateSpan"
        >
          <el-date-picker
            v-model="scope.row.APPOINTMENTDATE"
            style="width: 100%"
            type="datetimerange"
            :picker-options="pickerOptions"
            value-format="yyyy-MM-dd HH:mm:ss"
            :clearable="true"
            :disabled="isDisabled(scope.row)"
            :editable="false"
            range-separator="至"
            :unlink-panels="true"
            :placeholder="$t('sys.tips.esTip16')"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            @change="dateSend(scope.row)"
            @clear="clearCode(scope.row)"
          />
        </el-col>
      </template>
    </one-table-template>
    <Details
      v-if="detPopupsVisible"
      :key="editPopupsKey"
      :detpopups-visible="detPopupsVisible"
      :data-for-form="editRowData"
      :popups-state="editPopupsState"
      :title-name="titleName"
      @closedet="closedet"
      @save="save"
    />
    <edit
      v-if="showdia"
      dynamic-api-style="restful"
      :popups-visible.sync="showdia"
      :data-for-form="clickRowsData"
      @close="popClose"
    />
    <!-- <Edit
      v-if="editPopupsVisible"
      :key="editPopupsKey"
      :popups-visible="editPopupsVisible"
      :data-for-form="editRowData"
      :popups-state="editPopupsState"
      :title-name="titleName"
      @close="close"
      @addPDIsave="addPDIsave"
    /> -->
  </div>
</template>
<script>
import { oneTableWithViewTemplateMixins } from '@/components/mixins/oneTableWithViewTemplateMixins'
import { orgApis } from '@/api/vesalesapi'
import OneTableTemplate from '@/components/templates/oneTable'
import Details from '../orderAllocation/details'
// import datePicker from './datePicker.vue'
import Vue from 'vue'
import commData from '../common/index.js'
import { exportExcel } from '@/utils/getTimeString.js'
export default {
  name: 'OrderManagement',
  components: {
    OneTableTemplate,
    Edit: () => import('../../vehicleManagement/vehicleRegistrationInformation/edit'),
    // datePicker,
    Details
    // Edit
  },
  mixins: [oneTableWithViewTemplateMixins],
  // 阻塞路由预加载网格中组件的数据
  beforeRouteEnter(to, from, next) {
    Vue.prototype.$ConfigCache.CacheConfig.initData([to.path, 'supplierMessage-edit'], () => {
      next()
    })
  },

  data() {
    // 页面标识（与上面beforeRouteEnter中的对应）
    const viewPageCode = this.$route.path
    // 绑定事件配置化事件
    this.$ConfigCache.CacheConfig.bindEvent(this, [viewPageCode])
    return {
      dateOptionsType: '3',
      pickerOptions: {},
      showdia: false,
      clickRowsData: {},
      titleName: '',
      editRowData: {},
      editPopupsState: '',
      editPopupsVisible: false,
      detPopupsVisible: false,
      icon: 'el-icon-arrow-down',
      // 网格查询API配置对象
      apiConfig: orgApis.ordermanagementquery,
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: 'btnKey1',
          type: 'primary',
          size: 'small',
          clickEvent: () => this.queryTable(1),
          text: this.$t('sys.button.query'), // 查询
          name: 'search',
          position: 'right',
          fuzzySearch: true
        },
        {
          compKey: 'btnKey4',
          type: '',
          size: 'small',
          clickEvent: () => this.reset(),
          text: this.$t('sys.button.reset'),
          name: 'reset',
          position: 'right' // 重置
        },
        {
          compKey: 'btnKey4',
          type: '',
          size: 'small',
          clickEvent: () => this.exportExcel111(),
          text: this.$t('sys.button.export'),
          name: 'export',
          position: 'left' // 导出
        }
        // {
        //   compKey: 'btnKey6',
        //   type: '',
        //   size: 'small',
        //   clickEvent: () => {
        //     this.downloadFile(['/upload/notice/20210702/b8d8b789671e45aeba400414095953a4/新建文本文档.txt'])
        //   },
        //   text: '下载',
        //   name: 'export',
        //   position: 'left' // 导出
        // }
      ],
      // 动态组件-查询条件
      tableComponents:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path]
          .tableComponents &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path]
          .tableComponents.length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path]
            .tableComponents
          : [
            // 显示组件
            {
              compKey: 'compKey1',
              labelName: 'DMS订单编号：',
              codeField: 'saleOrderCode',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: true
            },
            {
              compKey: 'compKey2',
              labelName: 'C端订单编号：',
              codeField: 'saleOrderCodeC',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMul: false,
              isMust: true
            },
            {
              compKey: 'compKey3',
              labelName: '销售计划号：',
              codeField: 'salePlanCode',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMul: false,
              isMust: true
            },
            {
              compKey: 'compKey4',
              labelName: 'VIN码：',
              codeField: 'vin',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: true
            },
            {
              compKey: 'compKey5',
              labelName: '客户姓名：',
              codeField: 'custLxName',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: false
            },
            {
              compKey: 'compKey6',
              labelName: '客户电话：',
              codeField: 'custLxTel',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: false
            },
            {
              compKey: 'compKey7',
              labelName: '证件号码：',
              codeField: 'custCardNo',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              isMust: false
            },
            {
              compKey: 'compKey8',
              labelName: '购买方式：',
              codeField: 'buyTypeId',
              lookuptype: 'VE0117',
              component: () => import('@/components/org/LookupValue'),
              type: 'dropdownList',
              isMust: false
            },
            {
              compKey: 'compKey9',
              labelName: '交付门店：',
              codeField: 'deliveryDlrId',
              component: () => import('@/components/org/commonSelect'),
              type: 'dropdownList',
              isMust: false,
              disabled: false,
              oFields: 'deliveryDlrId,deliveryDlrShortName',
              customObj: {
                api: orgApis.ListOfDeliveryStore
              }
            },
            {
              compKey: 'compKey10',
              labelName: '交付专员：',
              codeField: 'empId',
              component: () => import('@/components/org/commonSelect'),
              type: 'dropdownList',
              isMust: false,
              disabled: false,
              parentFileds: 'value:deliveryDlrId',
              oFields: 'empId,empName',
              customObj: {
                listQuery: { deliveryDlrId: '' },
                api: orgApis.ListOfdeliveryPersonnel, selectType: '1'
              }
            },
            {
              compKey: 'compKey11',
              labelName: '订单标签：',
              codeField: 'saleOrderSign',
              lookuptype: 'VE1013',
              component: () => import('@/components/org/LookupValue'),
              type: 'dropdownList',
              isMust: false
            },
            {
              compKey: 'compKey12',
              labelName: '下单日期：',
              codeField: 'reserveDateStartTime,reserveDateEndTime',
              component: () => import('@/components/org/datePicker/datePicker.vue'),
              dateType: 'daterange',
              isMul: false,
              isMust: false
            },
            ...commData.ModelOptions(),
            {
              compKey: 'compKey19',
              span: 18,
              codeField: 'switch',
              component: () => import('./switch'),
              isMust: false
            },
            {
              compKey: 'compKey20',
              span: 24,
              codeField: 'orderStatus',
              isMul: true,
              isShow: false,
              component: () => import('./orderStatus'),
              type: '',
              isMust: false
            }
          ],
      // 动态生成网格列
      tableCols:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols
          .length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols
          : [
            {
              prop: 'controlBtn',
              isSlot: true,
              label: '操作',
              width: 180
            },
            {
              prop: 'saleOrderCode',
              label: 'DMS订单编号',
              width: 120
            },
            {
              prop: 'saleOrderCodeC',
              label: 'C端订单编号',
              width: 120
            },
            {
              prop: 'orderStatusName',
              label: '订单状态', width: 120
            },
            {
              prop: 'vlsStatus',
              label: '物流状态', width: 120
            },
            {
              prop: 'saleOrderSignName',
              label: '订单标签', width: 120
            },
            {
              prop: 'salePlanCode',
              label: '销售计划号',
              isComponent: true,
              comps: [
                {
                  compKey: 'propKey4',
                  align: 'center',
                  codeField: 'salePlanCode',
                  isColComp: true,
                  clickEvent: index => { this.goto(index) },
                  component: () => import('@/components/org/linkButton')
                }
              ],
              width: 160
            },
            {
              prop: 'VIN',
              label: 'VIN码',
              isComponent: true,
              comps: [
                {
                  compKey: 'propKey5',
                  align: 'center',
                  codeField: 'VIN',
                  isColComp: true,
                  clickEvent: index => { this.goto(index) },
                  component: () => import('@/components/org/linkButton')
                }
              ],
              width: 160
            },
            {
              prop: 'receivedAmount',
              label: '已收金额', width: 120
            },
            {
              prop: 'advicePrice',
              label: '整车金额', width: 120
            },
            {
              prop: 'buyTypeName',
              label: '购买方式', width: 120
            },
            {
              prop: 'remark',
              isSlot: true,
              label: '备注', width: 120
            },
            {
              prop: 'custName',
              label: '客户姓名', width: 120
            },
            {
              prop: 'custTel',
              label: '客户电话',
              width: 120
            },
            {
              prop: 'credTypeName',
              label: '车主证件类型', width: 120
            },
            {
              prop: 'custCardNo',
              label: '车主证件号码',
              width: 160
            },
            {
              prop: 'custLxName',
              label: '联系人姓名', width: 120
            },
            {
              prop: 'custLxPhone',
              label: '联系人电话',
              width: 120
            },
            {
              prop: 'buyUserName',
              label: '购买用途', width: 120
            },
            // {
            //   prop: 'buyModleName',
            //   label: '购买形态', width: 120
            // },
            {
              prop: 'reserveDate',
              label: '下单日期',
              width: 180
            },
            {
              prop: 'caEmpName',
              label: '销售人员', width: 120
            },
            {
              prop: 'caEmpPhone',
              label: '销售人员电话',
              width: 120
            },
            {
              prop: 'dlrShortNameN',
              label: '销售门店', width: 120
            },
            {
              prop: 'MatchPath',
              label: '匹配路径',
              width: 180
            },
            {
              prop: 'crmPreDeliverDate',
              label: '预计交车日期',
              width: 180
            },
            {
              prop: 'dlrShortName',
              label: '交付门店', width: 120
            },
            {
              prop: 'dlrName',
              label: '门店类别', width: 120
            },
            {
              prop: 'empName',
              label: '交付专员', width: 120
            },
            {
              prop: 'LastInDlrstockDate',
              label: '车辆验收入库时间', width: 180
            },
            {
              prop: 'PriorityLevel',
              label: '订单优先级', width: 180,
              // sortable: true,
              isComponent: true,
              comps: [
                {
                  compKey: 'propKey9',
                  codeField: 'PriorityLevel',
                  isColComp: true,
                  isAsync: true,
                  clearable: false,
                  lookuptype: 'VE1227',
                  component: () => import('@/components/org/commonSelect'),
                  type: 'dropdownList'
                }
              ]
            },
            {
              prop: 'SaleContractDate',
              sortable: 'custom',
              label: '合同签署日期', width: 180
            },
            {
              prop: 'CreatedDate',
              sortable: 'custom',
              label: '创建日期', width: 180
            },
            {
              prop: 'earnestMoneyPayTime',
              label: '付大定时间', width: 180
            },
            {
              prop: 'APPOINTMENTDATE',
              isSlot: true,
              label: '客户预约时间段',
              width: 350
            },
            {
              prop: 'sendPersionDate',
              label: '车辆发运日期', width: 180
            },
            {
              prop: 'deliveryDate',
              label: '实际交付日期', width: 180
            },
            {
              prop: 'PDIFlag',
              label: '新车PDI状态', width: 120
            },
            {
              prop: 'PDIDate',
              label: '新车PDI时间', width: 120
            },
            {
              prop: 'carSeriesCode',
              label: '车系编码', width: 120
            },
            {
              prop: 'carSeriesCn',
              label: '车系名称', width: 120
            },
            {
              prop: 'carConfigCode',
              label: '基础车型编码', width: 120
            },
            {
              prop: 'carConfigCn',
              label: '基础车型名称', width: 120
            },
            {
              prop: 'OptionalPagCode',
              label: '选装包编码', width: 120
            },
            {
              prop: 'optionalPagName',
              label: '选装包', width: 120
            },
            {
              prop: 'CarColorCode',
              label: '车身颜色编码', width: 120
            },
            {
              prop: 'carColorName',
              label: '车身颜色', width: 120
            },
            {
              prop: 'CarIncolorCode',
              label: '内饰颜色编码', width: 120
            },
            {
              prop: 'carIncolorName',
              label: '内饰颜色', width: 120
            },
            {
              prop: 'saleChannelsName',
              label: '订单来源', width: 120
            }
          ],
      formField: {
        saleOrderCode: '',
        saleOrderCodeC: '',
        salePlanCode: '',
        vin: '',
        custLxName: '',
        custLxTel: '',
        custCardNo: '',
        buyTypeId: '',
        deliveryDlrId: '',
        empId: '',
        saleOrderSign: '',
        reserveDateStartTime: '',
        reserveDateEndTime: '',
        carSeriesId: '',
        carConfigId: '',
        carColorId: '',
        carIncolorId: '',
        optionalPagId: '',
        orderStatus: ''
      },
      // 是否使用刷新Key的方式刷新弹窗
      resetDialogKey: true,
      refreshTableKey: '0',
      status: false,
      dateSpan: 24,
      // 岗位编码
      stationCode: '',
      // 单表格模版页面组件回调事件
      callbackObj: {
        // 重置后事件
        onAfterReset: (formField, backFormField) => {
          this.isHost()
        },
        // 网格组件值发生变化
        onQueryReturn: (res) => {
          res.rows.forEach(item => {
            if (item.APPOINTMENTDATE) {
              item.APPOINTMENTDATE = item.APPOINTMENTDATE.split(',')
            }
          })
        },
        onRowCompCodeChange: (popupsKey, comType, otherField, selectData, val, txt, codeField) => {
          var { updateControlId, saleOrderId, PriorityLevel, APPOINTMENTDATE, saleOrderCodeC, VIN } = this.$refs.multipleTable.list[comType]
          switch (PriorityLevel) {
            case '高':
              PriorityLevel = '1'
              break
            case '中':
              PriorityLevel = '2'
              break
            case '低':
              PriorityLevel = '3'
              break
            default:
              break
          }
          this.$refs.multipleTable.listLoading = true
          const that = this
          const queryObj = {
          // api配置
            apiConfig: orgApis.orderTimeChange,
            // 条件/实体参数（变量），根据typeParam中的定义配置
            variables: {
            // 当前中台使用的名称有dataInfo、info，具体查看API文档
              dataInfo: {
                updateControlId, saleOrderCodeC, VIN,
                saleOrderId,
                PriorityLevel,
                APPOINTMENTDATE: APPOINTMENTDATE ? APPOINTMENTDATE.join(',') : '' }
            }
          }
          // 转换了中台请求格式数据
          var paramD = that.$getParams(queryObj)
          // 调用中台API方法（可复用）
          that.$requestAPI(paramD).then(response => {
            this.$refs.multipleTable.listLoading = false
            this.$message({
              message: response.msg,
              duration: 2000
            })
            if (response.result === '1') {
              this.queryTable()
            }
          }).catch((response) => {
            console.log(response)
            this.$refs.multipleTable.listLoading = false
            this.$message({
              message: response.msg,
              duration: 2000
            })
          })
        }
      }
    }
  },
  watch: {
    'formField.orderStatus': {
      deep: true,
      handler: function(newV, oldV) {
        this.queryTable()
      }
    }
  },
  created() {
    const that = this
    that.pickerOptions.disabledDate = function(time) {
      if (that.dateOptionsType) {
        switch (that.dateOptionsType) {
          // 禁用当前日期之后的日期（不包括当前日期）
          case '1':
            return time.getTime() > Date.now()
          // 禁用当前日期之前的日期（包括当前日期）
          case '2':
            return time.getTime() < Date.now()
          // 禁用当前日期之前的日期（不包括当前日期）
          case '3':
            return time.getTime() < Date.now() - 8.64e7
        }
      }
      return false
    }
  },
  mounted() {
    this.isHost()
    this.$nextTick(() => {
      this.queryTable(1)
      setTimeout(() => {
        this.setTableHeight()
      }, 100)
    })
  },
  methods: {
    // 获取门店信息设置交付门，交付专员禁用
    isHost() {
      var { EMP_ID, DLR_ID } = this.$store.getters.orgInfo
      var stationCode = this.$store.getters.stationCode
      console.log(stationCode)
      if (DLR_ID !== 'HOST') {
        console.log(stationCode)
        this.tableComponents.forEach(item => {
          if (item.codeField === 'deliveryDlrId') {
            this.formField.deliveryDlrId = DLR_ID
            item.disabled = true
          }
          if (item.codeField === 'empId' && stationCode !== '' && stationCode === '008') {
            this.formField.empId = EMP_ID
            item.disabled = true
          }
        })
      }
    },
    downloadFile(res) {
      this.$utils.FileDownload(res)
    },
    // 清除日期
    clearCode(res) { },
    remarkSend(res) {
      var { saleOrderId, remark, updateControlIdD } = res
      this.$refs.multipleTable.listLoading = true
      const that = this
      const queryObj = {
        // api配置
        apiConfig: orgApis.updRemark,
        // 条件/实体参数（变量），根据typeParam中的定义配置
        variables: {
          // 当前中台使用的名称有dataInfo、info，具体查看API文档
          dataInfo: {
            updateControlIdD,
            saleOrderId,
            remark }
        }
      }
      // 转换了中台请求格式数据
      var paramD = that.$getParams(queryObj)
      // 调用中台API方法（可复用）
      that.$requestAPI(paramD).then(response => {
        this.$refs.multipleTable.listLoading = false
        this.$message({
          message: response.msg,
          duration: 2000
        })
        if (response.result === '1') {
          this.queryTable()
        }
      }).catch((response) => {
        this.$refs.multipleTable.listLoading = false
        this.$message({
          message: response.msg,
          duration: 2000
        })
      })
    },
    dateSend(res) {
      var { updateControlId, saleOrderId, PriorityLevel, APPOINTMENTDATE, saleOrderCodeC, VIN } = res
      switch (PriorityLevel) {
        case '高':
          PriorityLevel = '1'
          break
        case '中':
          PriorityLevel = '2'
          break
        case '低':
          PriorityLevel = '3'
          break
        default:
          break
      }
      this.$refs.multipleTable.listLoading = true
      const that = this
      const queryObj = {
        // api配置
        apiConfig: orgApis.orderTimeChange,
        // 条件/实体参数（变量），根据typeParam中的定义配置
        variables: {
          // 当前中台使用的名称有dataInfo、info，具体查看API文档
          dataInfo: {
            updateControlId, saleOrderCodeC, VIN,
            saleOrderId,
            PriorityLevel,
            APPOINTMENTDATE: APPOINTMENTDATE ? APPOINTMENTDATE.join(',') : '' }
        }
      }
      // 转换了中台请求格式数据
      var paramD = that.$getParams(queryObj)
      // 调用中台API方法（可复用）
      that.$requestAPI(paramD).then(response => {
        this.$refs.multipleTable.listLoading = false
        this.$message({
          message: response.msg,
          duration: 2000
        })
        if (response.result === '1') {
          this.queryTable()
        }
      }).catch((response) => {
        console.log(response)
        this.$refs.multipleTable.listLoading = false
        this.$message({
          message: response.msg,
          duration: 2000
        })
      })
    },
    isDisabled(res) {
      var dateDisabled = true
      if (res.orderStatus === '8' || res.orderStatus === '10' || res.orderStatus === '11' || res.orderStatus === '12' || res.orderStatus === '13' || res.orderStatus === '14' || res.orderStatus === '15' || res.orderStatus === '16' || res.orderStatus === '17') {
        dateDisabled = false
      }
      return dateDisabled
    },
    PDishow(res) {
      var pdishow = false
      if (res.PDIFlag === '未做新车PDI') {
        if (res.orderStatus === '12' || res.orderStatus === '13') {
          if (res.saleOrderSign !== '3') {
            pdishow = true
          }
        }
      }
      return pdishow
    },
    // 车籍异动关闭
    popClose(type) {
      this.this.showdia = false
      if (type === 1) {
        this.queryTable(1)
      }
    },
    // 跳转
    goto(index) {
      const { VIN, salePlanCode } = this.$refs['multipleTable'].list[index]
      this.clickRowsData = this.$refs['multipleTable'].list[index]
      this.clickRowsData.vin = VIN
      this.clickRowsData.salesPlanCode = salePlanCode
      this.showdia = true
    },
    // 开票申请
    invoice(res) {
      const that = this
      var saleOrderId = res.saleOrderId
      const queryObj = {
        // api配置
        apiConfig: orgApis.ordermanagementInvoce,
        // 条件/实体参数（变量），根据typeParam中的定义配置
        variables: {
          // 当前中台使用的名称有dataInfo、info，具体查看API文档
          dataInfo: { saleOrderId: saleOrderId }
        }
      }
      this.$refs.multipleTable.listLoading = true
      // 转换了中台请求格式数据
      var paramD = that.$getParams(queryObj)
      // 调用中台API方法（可复用）
      that.$requestAPI(paramD).then(response => {
        this.$message({
          message: response.msg,
          duration: 2000
        })
        this.$refs.multipleTable.listLoading = false
        if (response.result === '1') {
          this.queryTable()
        }
      }).catch(err => {
        console.log(err)
        this.$refs.multipleTable.listLoading = false
      })
    },

    // 新车PDI弹窗打开订单已配车|已插单|车辆已发车|车辆验收入库|尾款已支付|车辆销售出库
    addPDI(res) {
      if (!res.empName) {
        this.$message('请先分配交付专员')
        return false
      }
      this.editRowData = res
      const { mobile, empName, deliverEmpId, saleOrderId, VIN, saleOrderCode } = res
      this.addPDIsave({ mobile, empName, deliverEmpId, saleOrderId, VIN, saleOrderCode })
    },

    // 新车PDI保存
    addPDIsave(res) {
      const that = this
      const queryObj = {
        // api配置
        apiConfig: orgApis.ordermanagementPDI,
        // 条件/实体参数（变量），根据typeParam中的定义配置
        variables: {
          // 当前中台使用的名称有dataInfo、info，具体查看API文档
          dataInfo: res
        }
      }
      // 转换了中台请求格式数据
      var paramD = that.$getParams(queryObj)
      // 调用中台API方法（可复用）
      that.$requestAPI(paramD).then(response => {
        this.$message({
          message: response.msg,
          type: 'info',
          duration: 2000
        })
        if (response.result === '1') {
          this.close('1')
        }
      })
    },

    // 关闭详情弹窗
    closedet() {
      this.detPopupsVisible = false
    },
    // 详情弹窗
    details(res) {
      this.detPopupsVisible = true
      this.editRowData = res
    },

    // 保存
    save(res) {
      if (res.index) {
        this.$refs.multipleTable.list[res.index] = res
        this.close()
        this.$message({
          message: '修改成功',
          type: 'success',
          duration: 2000
        })
      } else {
        this.$refs.multipleTable.list.push(res)
        this.close()
        this.$message({
          message: '保存成功',
          type: 'success',
          duration: 2000
        })
      }
    },
    // 导出
    exportExcel111() {
      // var obj = Object.assign(this.formField, { method: 'get' })
      exportExcel(this.formField, orgApis.ordermanagementexport.APIUrl, orgApis.ordermanagementexport.ServiceCode, '订单管理')
    }
  }
}
</script>
